package cn.myblog.ainblog.service;

import cn.myblog.ainblog.mapper.ReplyMapper;
import cn.myblog.ainblog.model.ReplyModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Dovaior
 * @Description 回复留言的service层
 * @create 2021-05-10 22:00
 **/
@Service
public class ReplyService {
    @Autowired
    private ReplyMapper replyMapper;

    /**
     * 添加回复
     * @param replyModel 回复的信息实体
     */
    public int addReply(ReplyModel replyModel){
        return replyMapper.insert(replyModel);
    }

    /**
     * 查询指定留言的回复内容
     * @param commentId 指定的留言id
     */
    public String queryReplyContentByCommentId(Long commentId){
        return replyMapper.queryReplyContentByCommentId(commentId);
    }

    /**
     * 删除指定留言的回复
     * @param commentId 指定的留言id
     */
    public int clearReplysByCommentId(Long commentId){
        return replyMapper.clearReplysByCommentId(commentId);
    }

    /**
     * 更新指定留言的回复
     * @param commentId 指定留言的id
     * @param replyContent 已经修改的回复内容
     */
    public int submitReplyChanges(Long commentId,String replyContent){
        return replyMapper.submitReplyChanges(commentId,replyContent);
    }
}
